package org.geektime.task.sbcachemanager.config;

import org.geektime.task.sbcachemanager.cache.RedisCacheManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;



@Configuration
public class CacheConfiguration extends CachingConfigurerSupport {

    @Autowired
    private CacheConfigProperty configProperty;

    @Bean
    @Override
    public CacheManager cacheManager() {
        String uri = "redis://" + configProperty.getCacheIp() + ":" + configProperty.getCachePort();
       RedisCacheManager redisCacheManager = new RedisCacheManager(uri);
       return redisCacheManager;
    }







}
